package com.modular.iot.opt;

import cn.hutool.core.lang.Opt;
import com.ToolOpt;
import com.c.opt.ComOpt;
import com.modular.iot.bean.ThingsProductDo;
import ntd.util.config.common.exception.ComException;
import ntd.util.modular.things.entity.Device;

/**
 * iot 产品信息操作
 */
public class OptIotProduct extends ComOpt<ThingsProductDo> {

    public OptIotProduct() {
        super("things_product");
    }

    public ThingsProductDo getByDeviceCode(String deviceCode) {
        Device byCode = ToolOpt.OPT_T_DEVICE.getByCode(Opt.ofBlankAble(deviceCode).orElseThrow(() -> new ComException("请传入设备编码...")));
        return getBeanById(byCode.getProductId());
    }

}
